﻿using System;
using System.Runtime.Serialization;

namespace WEIShareWCFRole.BusinessEntities.Paging
{
    [Serializable]
    [DataContract]
    public class PageRequest
    {
        /// <summary>
        /// The flag specifying if the request is for the admin area
        /// </summary>
        [DataMember]
        public bool IsAdmin { get; set; }

        /// <summary>
        /// The search text for which to search the results for
        /// </summary>
        [DataMember]
        public string SearchQuery { get; set; }

        /// <summary>
        /// The column to order results by
        /// </summary>
        [DataMember]
        public string OrderBy { get; set; }

        /// <summary>
        /// The direction, ASC or DESC, to order results by
        /// </summary>
        [DataMember]
        public string OrderByDirection { get; set; }

        /// <summary>
        /// The page number being requested
        /// </summary>
        [DataMember]
        public int PageNumber { get; set; }

        /// <summary>
        /// The size of the page
        /// </summary>
        [DataMember]
        public int PageSize { get; set; }

        /// <summary>
        /// A limited filter allowing a parameter and value
        /// </summary>
        [DataMember]
        public Filter Filter { get; set; }

        /// <summary>
        /// Designates whether or not to group the results
        /// </summary>
        [DataMember]
        public bool GroupResults { get; set; }
    }
    [Serializable]
    [DataContract]
    public class Filter
    {
        /// <summary>
        /// The column to filter by
        /// </summary>
        [DataMember]
        public string Parameter { get; set; }

        /// <summary>
        /// The value of the column to filter by
        /// </summary>
        [DataMember]
        public string Value { get; set; }
    }
}